<div class="center">
	<div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
            <?php //echo $this->render('member/menu.phtml'); ?>
        </div>
    	<div class="home_right">
            <div class="storehousetop">
                <div class="storehouse">
                    <div class="cloud">
                        <span>我的推荐</span>
                    </div>
                    <div class="storehouseinfo">
                        <h1>我的推荐链接</h1>
                        <div class="storehousenum">
                            推荐好友注册,每成功一位(须验证邮箱),您将得到50积分,好友发国际运单可得100积分,在签收后,您将得到此单运费10%的返利。
                        </div>
                    </div>
                </div>
                <div class="storehousenav">
                    <ul>
                        <li class="storehouseon"><a href="/member/recommend"><i class="storehouse1"></i>我的推荐链接</a></li>
                    </ul>
                </div>
            </div>
            <div class="dizhi">
            	<h2>我的推荐链接</h2>
                <div class="dizhitable">
                    <table>
                    	<tr>
                            <td class="dzz">链接地址：</td>
                            <td><p><span><?php echo $this->recommendUrl ?></span></p><i>重要</i><a href="javascript:void(0)" id="copycode"><span>复制</span></a></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="dizhi">
            	<h2>推荐返利金额记录</h2>
                <div class="dizhitable">
                    <table>
                    	<tr>
                            <td>被推荐的用户昵称</td>
                            <td>运单号</td>
                            <td>成本价</td>
                            <td>返利</td>
                            <td><div class="wen" style="width: 70px;">
                                        <div style="line-height: 35px;">操作<b class="wtb" style='right:40px;'>疑问</b></div>
                                        <div class="tc" style="display:none;margin-left:-135px;margin-top: 3px;">
                                            <div class="jtou" style="margin-left:160px"></div>
                                            <p>无法领取的原因：<br>该运单还没有签收或者已经取消了。</p>
                                       </div>
                                    </div></td>
                        </tr>
                        <?php foreach ($this->rewardList as $rewardVal) { ?>
                            <tr>
                                <td><?php echo $rewardVal->getUserItem($rewardVal->UserId)->Nikename;?></td>
                                <td><?php echo $rewardVal->BillNo;?></td>
                                <td><?php echo $rewardVal->Money>0?$rewardVal->Money:"计算中";?></td>
                                <td><?php echo $rewardVal->Rebate>0?$rewardVal->Rebate:"计算中";?></td>
                                <td><?php if($rewardVal->IsAbled == Application_Model_Reward::IsAbled_Unfinished){ ?>
                                    <span >无法领取</span>
                                <?php } else if ($rewardVal->IsAbled == Application_Model_Reward::IsAbled_Complete){ ?>
                                    <a href="javascript:void(0)" style="float: none;background: none;color: #f60;" class="clickReceive" name="<?php echo $rewardVal->Id;?>">点击领取</a>
                                <?php } else { ?>
                                    <span >已经领取</span>
                                <?php } ?>
                                </td>
                            </tr>
                        <?php }?>
                    </table>
                    <div class="toolbar">
                        <?php echo $this->partial('paging.phtml',array('pages'=>$this->rewardAll)); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
 
<div class="tanchuang" style="height: 300px;display: none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" style="font-size: 16px;">系统消息</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wenti_box" style="display: none;">
        <div style="margin-left: 20px;font-size: 16px;margin-top: 20px;width: 560px;">
            <h3>尊敬的会员：</h3>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;恭喜您，您的返利领取成功。</p>
            <p style="margin-top: 20px;margin-left: 150px;"><a href="javascript:void(0)" class="exitproblem" ><span class="countdown">10</span>秒后自动关闭，立即关闭。</a></p>
        </div>
    </div>
    <div class="wenti_box2" style="display: none;">
        <div style="margin-left: 20px;font-size: 16px;margin-top: 20px;width: 560px;">
            <h3>尊敬的会员：</h3>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对不起，您的返利领取失败。可能的原因如下：</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、可能是您已经领取过了，不能重复领取。</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、可能是该运单没有完成，无法领取。</p>
            <p style="margin-top: 20px;margin-left: 150px;"><a href="javascript:void(0)" class="exitproblem" ><span class="countdown">10</span>秒后自动关闭，点击立即关闭。</a></p>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display: none;"></div>

<!--分享参数代码结束-->
<!--分享功能代码统一放到页尾-->
<script type="text/javascript" src="http://v1.jiathis.com/code/jia.js?uid=1334580904971198" charset="utf-8"></script>
<!--分享功能代码结束-->
<script language="JavaScript">
    $('.wen').hover(function(){
        $('.tc',this).show();
    }, function(){
        $('.tc',this).hide();
    });
    var clip = null;
    var tel= null;

    function $c(id) { return document.getElementById(id); }

    function init() {
      clip = new ZeroClipboard.Client();
      ZeroClipboard.setMoviePath("/js/clip/ZeroClipboard.swf")
      clip.setHandCursor( true );
      clip.glue('d_clip_button');
      
      tel = new ZeroClipboard.Client();
      tel.setHandCursor( true );
      tel.glue('d_tel');
    }
    
    $(function(){
        
        $(".dizhitable #copycode").each(function() {
            //Create a new clipboard client
            var clip = new ZeroClipboard.Client();
            ZeroClipboard.setMoviePath("/js/clip/ZeroClipboard.swf");
            clip.setHandCursor( true );

            //Glue the clipboard client to the last td in each row
            clip.glue(this);


            //Grab the text from the parent row of the icon
            var code = $(this).parent().children('p').text() ;    
            clip.setText(code);

            //Add a complete event to let the user know the text was copied
            clip.addEventListener('complete', function(client, text) {
              alert("已经复制到剪贴板:\n" + text);
              //popUp(url);
            });
        });
    })
    var leftSeconds = 10;
    
    $(".nui-msgbox-close").click(function(){
        $("div.houtai_overlay").hide();
        $("div.tanchuang").hide();
        location.reload();
    });
    $(".exitproblem").click(function(){
        $("div.houtai_overlay").hide();
        $("div.tanchuang").hide();
        location.reload();
    }); 
    function CountDown() {
        if(leftSeconds<=0){
            $(".exitproblem").click();
        }
        leftSeconds--;
        $(".countdown").html(leftSeconds);
    }
    $(".clickReceive").click(function(){
        var id = $(this).attr("name");
        $.ajax({    
            type: 'POST',
            url: '/member/receiverebate/id/'+id,
            success: function(data) {
                $(".tanchuang").show();
                $(".houtai_overlay").show();
                if(data == 1){
                    $(".wenti_box").show();
                }else{
                    $(".wenti_box2").show();
                }
                setInterval("CountDown()", 1000);
            }
        });
    });
</script>